package engine.BIEngine0_1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RunnableAlgorithm {
	/**
	 * block id
	 */
	private String blockId;
	/**
	 * algorithm id
	 */
	private String algorithmId;
	/**
	 * task hash
	 */
	private String taskHash;
	/**
	 * identify key
	 */
	private String algorithmHash;
	/**
	 * algorithm file uri
	 */
	private String algorithmUri;
	/**
	 * algorithm name
	 */
	private String algorithmName;
	/**
	 * input uri
	 */
	public HashMap<String,String> inputValues;
	/**
	 * output uri
	 */
	public HashMap<String,String> outputValues;
	/**
	 * param values
	 */
	public HashMap<String,String> paramValues;
	/**
	 * key: previous block id
	 * value: previous object 1: is algorithm    0: is model
	 */
	public Map<String,Integer> preBlockMap;
	/**
	 * key: post block id
	 * value: post object 1: is algorithm    0: is model
	 */
	public Map<String,Integer> postBlockMap;
	/**
	 * priority
	 */
	private Integer priority;
	/**
	 * introduction
	 */
	private String introduction;
	/**
	 * strategy
	 */
	private String strategy;
	/**
	 * user id
	 */
	private String userId;

	@Override
	public String toString() {
		String in = "\n";
		for(Map.Entry<String, String> i:this.inputValues.entrySet()){
			in += i.getKey()+":"+i.getValue()+"\n";
		}
		String out = "\n";
		for(Map.Entry<String, String> i:this.outputValues.entrySet()){
			out += i.getKey()+":"+i.getValue()+"\n";
		}
		String param = "\n";
		for(Map.Entry<String, String> i:this.paramValues.entrySet()){
			param += i.getKey()+":"+i.getValue()+"\n";
		}
		String pre = "\n";
		for(Map.Entry<String, Integer> i:this.preBlockMap.entrySet()){
			pre += i.getKey()+":"+i.getValue()+"\n";
		}
		String post = "\n";
		for(Map.Entry<String, Integer> i: this.postBlockMap.entrySet()){
			post += i.getKey()+":"+i.getValue()+"\n";
		}
		return "RunnableAlgorithm [algorithmId=" + algorithmId + "taskHash=" + taskHash + ", algorithmHash=" + algorithmHash + ", algorithmUri="
				+ algorithmUri + ", algorithmName=" + algorithmName + " \ninputValues=" + in + " \noutputValues="
				+ out + " \nparamValues=" + param + ", priority=" + priority + ", introduction="
				+ introduction + ", strategy=" + strategy + ", userId=" + userId + ", algorithmId=" + algorithmId + "\n"
						+ "pre:"+pre+"\npost:"+post+"]\n\n\n\n\n";
	}
	public RunnableAlgorithm(String taskHash, String algorithmHash, String algorithmName) {
		super();
		this.taskHash = taskHash;
		this.algorithmHash = algorithmHash;
		this.algorithmName = algorithmName;
	}
	public RunnableAlgorithm(String taskHash, String algorithmUri, String algorithmName,
			HashMap<String, String> inputValues, HashMap<String, String> outputValues,
			HashMap<String, String> paramValues, Integer priority, String strategy) {
		super();
		this.taskHash = taskHash;
		this.algorithmUri = algorithmUri;
		this.algorithmName = algorithmName;
		this.inputValues = inputValues;
		this.outputValues = outputValues;
		this.paramValues = paramValues;
		this.priority = priority;
		this.strategy = strategy;
	}
	public RunnableAlgorithm() {
		this.inputValues = new HashMap<>();
		this.outputValues = new HashMap<>();
		this.paramValues = new HashMap<>();
	}
	
	public String getAlgorithmId() {
		return algorithmId;
	}
	public void setAlgorithmId(String algorithmId) {
		this.algorithmId = algorithmId;
	}
	/**
	 * @return
	 */
	public String getTaskHash() {
		return taskHash;
	}
	public void setTaskHash(String taskHash) {
		this.taskHash = taskHash;
	}
	public String getBlockId() {
		return blockId;
	}
	public void setBlockId(String blockId) {
		this.blockId = blockId;
	}
	public String getAlgorithmHash() {
		return algorithmHash;
	}
	public void setAlgorithmHash(String algorithmHash) {
		this.algorithmHash = algorithmHash;
	}
	public String getAlgorithmUri() {
		return algorithmUri;
	}
	public void setAlgorithmUri(String algorithmUri) {
		this.algorithmUri = algorithmUri;
	}
	public String getAlgorithmName() {
		return algorithmName;
	}
	public void setAlgorithmName(String algorithmName) {
		this.algorithmName = algorithmName;
	}
	public HashMap<String, String> getInputValues() {
		return inputValues;
	}
	public void setInputValues(HashMap<String, String> inputValues) {
		this.inputValues = inputValues;
	}
	public HashMap<String, String> getOutputValues() {
		return outputValues;
	}
	public void setOutputValues(HashMap<String, String> outputValues) {
		this.outputValues = outputValues;
	}
	public HashMap<String, String> getParamValues() {
		return paramValues;
	}
	public void setParamValues(HashMap<String, String> paramValues) {
		this.paramValues = paramValues;
	}
	public Integer getPriority() {
		return priority;
	}
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	public String getIntroduction() {
		return introduction;
	}
	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}
	public String getStrategy() {
		return strategy;
	}
	public void setStrategy(String strategy) {
		this.strategy = strategy;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	
	
}
